﻿<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <span id="span1"></span>
    <script src="../../js/ultis.js"></script>
  <script>
    //需求：在页面停留的时间
    //第一步：先拿到进入页面的时间
    let preDate = new Date();
    //第二步：求在页面停留的时间
    setInterval(function () {
      let curDate = new Date(); //停留时候获取的时间
      span1.innerHTML = timeDifference(curDate, preDate)
    }, 1000)
  </script>
</body>

</html>